﻿@model PagedList.IPagedList<Model.goods>
@using PagedList.Mvc;
@using System;

<link href="~/Content/css/PagedList.css" rel="stylesheet" />
<div id="ajax">
    <div id="goods-wrapper">
        @if (Model.Count() == 0)
        {
            <style>
                .no-result {
                    font-size: 200%;
                }
            </style>
            <div class="no-result">没有搜索到任何结果，请返回或重新搜索！</div>   
        }
        <ul class="goods-ul">
            @foreach (var item in Model)
            {
                string tag, tag_font;
                Random num = new Random();
                int rd = num.Next(1, 5);
                <li class="goods-li">
                    <a href="@Url.Action("GoodDetails","Store",new { ID = item.ID})">
                        <img src="/Content/images/@item.goodImage" />

                        <h3>
                            <a>@item.goodName</a>
                        </h3>
                        <p>
                            <strong>
                                ¥@item.goodprice
                            </strong>
                            <span>1000+件在售</span>
                        </p>
                    </a>
                    @if (rd % 2 == 0)
                    {
                        tag = "#397439";
                        tag_font = "崭新出场";
                    }
                    else
                    {
                        tag = "#F1AD4D";
                        tag_font = "久经沙场";
                    }
                    <span class="tag" style="background:@tag">@tag_font</span>
                </li>
            }
        </ul>
    </div>
    @Html.PagedListPager(Model, page => Url.Action("GoodsClassificationPatialView", "Store", new { page = page, type = 0 }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new PagedListRenderOptions { LinkToFirstPageFormat = "首页", LinkToLastPageFormat = "尾页", MaximumPageNumbersToDisplay = 5 }, new AjaxOptions { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "ajax" }))
</div>

@section css{
    <link href="~/Content/css/PagedList.css" rel="stylesheet" />
    <link href="~/Content/css/GoodsClassicationPatialView.css" rel="stylesheet" />
}